<?php
// $Id$

/**
 * Controller_Boprepare 控制器
 */
class Controller_Boprepare extends Controller_Abstract
{
    public function __construct()
    {
        parent::__construct(NULL);
        $this->validateRoles();
    }

    private function validateRoles()
    {
        $requiredRolesTable = array(
            'bocron'       => array(1),
            'bofaculty'    => array(1, 4),
            'bofile'       => array(1, 3, 6),
            'bohome'       => array(1, 2, 3, 4, 5, 6),
            'bonewsnotice' => array(1, 2, 6),
            'botag'        => array(1, 2, 6),
            'botest'       => array(1),
            'botraffic'    => array(1),
        );
      
        $allowPass = 0;
        foreach($requiredRolesTable as $requestUri => $requiredRole)
        {
            if(strpos($_SERVER['REQUEST_URI'], $requestUri) === FALSE)
            {
                continue;
            }

            if(in_array($_SESSION['lrole_id'], $requiredRole) == 1)
            {
                $allowPass = 1;
                break;
            }
        }

        if($allowPass == 0)
        {
            return $this->_forward('home/index');
        }
    }
}